Reasoning about explicit strictness in a lazy language using mixed lazy/strict semantics
نویسندگان
چکیده
Abstract. Many functional programmers are familiar with the concept of enforcing strictness for making applications fit their time and space efficiency requirements. Few functional programmers however, are familiar with the consequences of enforcing strictness for formal reasoning about their programs. This paper attempts to fill the gap between the few and the many. Some typical examples are given of the use and the meaning of explicit strictness. We show how formal reasoning can be made easier by the introduction of auxiliary functions in the program. John Launchbury’s [Lau93] natural lazy semantics for lazy evaluation is extended with an explicit strict let construct. We show that this rule extends the semantics in a natural way. In fact, using our mixed semantics it is possible to express in the language itself the semantical difference between Ω and λx.Ω while in Launchbury’s model these two expressions can only be distinguished from outside the language.
منابع مشابه
Mixed Lazy/Strict Graph Semantics
Explicitly enforcing strictness is often used by functional programmers as an important tool for making applications fit time and space efficiency requirements. Few functional programmers however, are familiar with the consequences of explicitly enforcing strictness for formal reasoning about their programs. Some “folklore” knowledge has emerged but this is based on experience rather than on ri...
متن کاملProving Lazy Folklore with Mixed Lazy/strict Semantics
Abstract. Explicit enforcement of strictness is used by functional programmers for many different purposes. Few functional programmers, however, are aware that explicitly enforcing strictness has serious consequences for (formal) reasoning about their programs. Some vague “folklore” knowledge has emerged concerning the correspondence between lazy and strict evaluation but this is based on exper...
متن کاملFine Control of Demand in Haskell
Functional languages have the -calculus at their core, but then depart from this rm foundation by including features that alter their default evaluation order. The resulting mixed evaluation|partly lazy and partly strict|complicates the formal semantics of these languages. The functional language Haskell is such a language, with features such as pattern-matching, case expressions with guards, e...
متن کاملLenient evaluation is neither strict nor lazy
What is a non-strict functional language? Is a non-strict language necessarily lazy? What additional expressiveness brings non-strictness, with or without laziness? This paper tries to shed some light on these questions. First, in order to characterize non-strictness, di1erent evaluation strategies are introduced: strict, lazy, and lenient. Then, using program examples, how these evaluation str...
متن کاملProof Tool Support for Explicit Strictness
In programs written in lazy functional languages such as for example Clean and Haskell, the programmer can choose freely whether particular subexpressions will be evaluated lazily (the default) or strictly (must be specified explicitly). It is widely known that this choice affects program behavior, resource consumption and semantics in several ways. However, not much experience is available abo...
متن کامل